package com.generate.tpp;

import java.util.ArrayList;
import java.util.List;

import com.jfinal.kit.LogKit;

public class _TppTest {

    public static void main(String[] args) {
        String className = "newstype";
        String tableName = "sm_newstype";

        JfGenerator.me
        .setSrcFolder("src/main/java")
        .setViewFolder("src/main/webapp/WEB-INF/view")
        .setPackageBase("com.basemanage")
        .setBasePath("controller")
        .tableSql(getSqlList())
        .javaRender(className, tableName)
        .htmlRender(className, tableName);

        LogKit.info("---------OK-刷新一下项目吧---------");
    }
    
    /**
     * 建表语句
     * @return
     */
    private static List<String> getSqlList() {
        ArrayList<String> sqlList = new ArrayList<String>();
        
        sqlList.add("DROP TABLE IF EXISTS `sm_newstype`;");
        sqlList.add("CREATE TABLE `sm_newstype` ("+
        		  "`id` int(11) NOT NULL,"+
        		  "`category` varchar(255) NOT NULL,"+
        		  "`name` varchar(255) NOT NULL,"+
        		  "`summary` varchar(255) NOT NULL,"+
        		  "`insto` varchar(255) DEFAULT NULL,"+
        		  "PRIMARY KEY (`id`)"+
        ")ENGINE=InnoDB DEFAULT CHARSET=utf8");
        return sqlList;
    }
 
}
